package net.maku.events.dao;

import net.maku.framework.mybatis.dao.BaseDao;
import net.maku.events.entity.UserUnlockSiteEntity;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 用户解锁站点
 *
 * @author 阿沐 babamu@126.com
 * @since 1.0.0 2025-03-22
 */
@Mapper
public interface UserUnlockSiteDao extends BaseDao<UserUnlockSiteEntity> {

    void insertBatchData(@Param("entityList") List<UserUnlockSiteEntity> entityList);

    @Delete("DELETE FROM user_unlock_site WHERE user_id = #{userId}")
    void forceDeleteByUserId(@Param("userId") Long userId);


    @Insert("INSERT INTO user_unlock_site(" +
            "walk_activity_id, walk_activity_site_id, user_id, " +
            "site_sort, create_time, update_time, " +
            "updater, creator) " +
            "VALUES (" +
            "#{entity.walkActivityId}, #{entity.walkActivitySiteId}, #{entity.userId}, " +
            "#{entity.siteSort}, " +
            "#{entity.createTime}, #{entity.updateTime}, " +
            "#{entity.updater}, #{entity.creator})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insertWithFixedTime(@Param("entity") UserUnlockSiteEntity entity);


}